using System;
using Castle.ActiveRecord;

namespace IronMis2.Models
{
    [ActiveRecord("commodity_record")]
    public class CommodityRecord:ActiveRecordBase<CommodityRecord>
    {
        private Guid id;
        private string crcdId;
        private string crcdName;
        private string crcdSimpleCode;
        private string crcdSpec;
        private string crcdType;
        private string crcdUnit;
        private decimal crcdPrice;
        private long crcdStor;
        private string crcdRemark;
        private Provider provider;
        private DateTime? crcdDate;
        private Storehouse storHouse;
        private long crcdCheckNum;
        private decimal crcdCheckNomkey;
        private long crcdPLNum;
        private long crcdExchangeNum;
        private Check check;
        private Exchange exchange;

        [Property(Column = "exchange_num",SqlType = "numeric",Length = 9)]
        public long CrcdExchangeNum
        {
            set { crcdExchangeNum = value; }
            get { return crcdExchangeNum; }
        }

        [PrimaryKey(PrimaryKeyType.GuidComb,Column = "id")]
        public Guid Id
        {
            set { id = value; }
            get { return id; }
        }

        [Property(Column = "crcd_id",SqlType = "char",Length = 10)]
        public string CrcdId
        {
            set { crcdId = value; }
            get { return crcdId; }
        }
        
        [Property(Column = "crcd_name",SqlType = "varchar",Length = 50)]
        public string CrcdName
        {
            set { crcdName = value; }
            get { return crcdName; }
        }

        [Property(Column = "crcd_simple_code",SqlType = "char",Length = 20)]
        public string CrcdSimpleCode
        {
            set { crcdSimpleCode = value; }
            get { return crcdSimpleCode; }
        }

        [Property(Column = "crcd_spec",SqlType = "char",Length = 20)]
        public string CrcdSpec
        {
            set { crcdSpec = value; }
            get { return crcdSpec; }
        }

        [Property(Column = "crcd_type",SqlType = "char",Length = 20)]
        public string CrcdType
        {
            set { crcdType = value; }
            get { return crcdType; }
        }

        [Property(Column = "crcd_units",SqlType = "char",Length = 10)]
        public string CrcdUnit
        {
            set { crcdUnit = value; }
            get { return crcdUnit; }
        }

        [Property(Column = "crcd_in_price",SqlType = "decimal",Length = 9)]
        public decimal CrcdPrice
        {
            set { crcdPrice = value; }
            get { return crcdPrice; }
        }

        [Property(Column = "crcd_storage",SqlType = "numeric",Length = 9)]
        public long CrcdStor
        {
            set { crcdStor = value; }
            get { return crcdStor; }
        }

        [Property(Column = "crcd_remark",SqlType = "varchar",Length = 50)]
        public string CrcdRemark
        {
            set { crcdRemark = value; }
            get { return crcdRemark; }
        }

        [BelongsTo(Column = "pro_id",ForeignKey = "id",Insert = true,Update = true,Fetch = FetchEnum.Select)]
        public Provider Provider
        {
            set { provider = value; }
            get { return provider; }
        }

        [Property(Column = "crcd_date",SqlType = "datetime",Length = 8)]
        public DateTime? CrcdDate
        {
            set { crcdDate = value; }
            get { return crcdDate; }
        }

        [BelongsTo(Column = "stor_id",ForeignKey = "id",Insert = true,Update = true,Fetch = FetchEnum.Select)]
        public Storehouse StoreHouse
        {
            set { storHouse = value; }
            get { return storHouse; }
        }

        [Property(Column = "crcd_check_num",SqlType = "numeric",Length = 9)]
        public long CrcdCheckNum
        {
            set { crcdCheckNum = value; }
            get { return crcdCheckNum; }
        }

        [Property(Column = "crcd_check_money",SqlType = "decimal",Length = 9)]
        public decimal CrcdCheckMonkey
        {
            set { crcdCheckNomkey = value; }
            get { return crcdCheckNomkey; }
        }

        [Property(Column = "crcd_pl_num",SqlType = "numeric",Length = 9)]
        public long CrcdPLNum
        {
            set { crcdPLNum = value; }
            get { return crcdPLNum; }
        }

        [BelongsTo(Column = "check_id",ForeignKey = "id",Insert = true,Update = true,Fetch = FetchEnum.Select)]
        public Check Check
        {
            set { check = value; }
            get { return check; }
        }

        [BelongsTo(Column = "exchange_id", ForeignKey = "id", Insert = true, Update = true, Fetch = FetchEnum.Select)]
        public Exchange Exchange
        {
            set { exchange = value; }
            get { return exchange; }
        }
    }
}
